export default {
  methods: {
    // 固定
    onHidden () {
      document.getElementById('body').scrollTop = 0
      document.documentElement.scrollTop = 0
      document.getElementById('body').style.overflow = 'hidden'
      document.documentElement.style.overflow = 'hidden'
    },
    // 滚动
    onAuto () {
      if (document.getElementById('body').getAttributeNode('style')) {
        document.getElementById('body').removeAttributeNode(document.getElementById('body').getAttributeNode('style'))
        document.getElementById('body').style['-webkit-overflow-scrolling'] = 'touch'
      }
      if (document.documentElement.getAttributeNode('style')) {
        document.documentElement.removeAttributeNode(document.documentElement.getAttributeNode('style'))
        document.documentElement.style['-webkit-overflow-scrolling'] = 'touch'
      }
    }
  },
  activated () {
    document.getElementById('body').scrollTop = 0
    document.documentElement.scrollTop = 0
  },
  // 销毁前清除
  beforeDestroy () {
    this.onAuto()
  },
  destroyed () {
  }
}
